package com.bnlr.lrparking.adapter;

import android.content.Intent;
import android.support.annotation.Nullable;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.bnlr.lrparking.R;
import com.bnlr.lrparking.appui.login.VerificaActivity;
import com.bnlr.lrparking.app.AppConfig;
import com.bnlr.lrparking.model.StallListBean;
import com.bnlr.lrparking.view.CarCommon;

import java.util.List;

/**
 * Created by tian on 2017/9/16.
 */

public class RentBuyAdapter extends BaseQuickAdapter<StallListBean.DataBean,BaseViewHolder>{

    private CarCommon carCommon=new CarCommon();

    public RentBuyAdapter(@Nullable List<StallListBean.DataBean> data) {
        super(R.layout.item_stallrentbuy,data);
    }

    @Override
    protected void convert(final BaseViewHolder holder, StallListBean.DataBean item) {
        holder.setIsRecyclable(false);
        holder.setText(R.id.item_type,item.getStatus());
        holder.setText(R.id.tv_stalldeal_title,item.getTitle());
        holder.setText(R.id.tv_stalldeal_size,item.getSize()+"㎡");
        holder.setText(R.id.tv_stalldeal_address_deilsa,item.getArea());
        holder.setText(R.id.tv_stalldeal_price,item.getPrice());
        holder.setText(R.id.tv_stalldeal_address,item.getArea());
        holder.setText(R.id.tv_rentbuy,item.getCreateTime());
        holder.setOnClickListener(R.id.img_rentbuy_phone, new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (!AppConfig.getInstance().getBoolean("isLogin",false)) {
                    mContext.startActivity(new Intent(mContext, VerificaActivity.class));
                    return;
                }
                carCommon.phoneDialog(mContext);
            }
        });
    }
}
